package com.yungu.swift.utils;

import java.math.BigDecimal;

/**
 * 格式化工具类
 *
 * @author Zerrion
 * @date 2017/12/27
 */
public class FormatUtils {

    private FormatUtils() {
    }

    public static Double formatDouble(Double value, int digit) {
        return new BigDecimal(value.toString()).setScale(digit, BigDecimal.ROUND_HALF_UP).doubleValue();
    }

    public static Double formatDouble(Double value) {
        return formatDouble(value, 2);
    }
}
